<?php
/*
	[English learning system]
	NAME:admin_control
*/

if (!defined('IN_ELS'))
{
    die('Hacking attempt');
}
class control extends uploadImgbase {
	var $pagecount 		= 0;
	var $currendnum 	= 1;
	var $pageSize 		= 15;	//每页多少条
	var $pageNumSize 	= 10;	//分页数
	
	function control() {
		$this->uploadImgbase();
		
		$act=empty($_REQUEST['a']) ? 'empty' : $_REQUEST['a'];
		if($act=="login"){
			if($this->doLogin()){
//				$this->adminIframe();
				$this->pageRedirect("admin.php?p=admin");
			}else{
				$this->loginPage();
			}
			exit;
		}
		
		if($act=="empty") 				$this->upList();
		if($act=='shangchuan')		$this->shangchuan();
		
	}
	
	function upList()
	{
		
		
		$this->view->display('uploadImg');	
	}
	
	function shangchuan()
	{
		echo "<pre/>";
		print_r($_FILES['files']);
		$arrs_type = array('png','jpg','jpeg','gif');
		$name = $_FILES['files']['name'];
		$size = $_FILES['files']['size'];
		$error= $_FILES['files']['error'];
		$type = $_FILES['files']['type'];
		$houzhui = explode('.',$name);
		
		if(!in_array($houzhui[1],$arrs_type))
		{
			echo "不是图片格式";exit;
		}
		else
		{		
			if($size>100000)
			{
				echo "图片太大，请从新选择";exit;
			}
			else
			{
				if($error!=0)
				{
					echo "上传错误！";exit;
				}
				else
				{
					//开始上传图片了
					$name1 = date('Ym');
					$name2 = date('d');
					$file_path = "data/upImage/".$name1."/";
					if(!@file_exists($file_path))
					{
						@mkdir($file_path,0777);
					}





				}
			}
		}

	}
	
	
}

?>